# -*- coding:utf-8 -*-

from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.linear_model import LinearRegression,SGDRegressor,Ridge
from sklearn.metrics import mean_squared_error
from sklearn import preprocessing
import joblib
import sys

sys.path.append("../")
from frameworks.utils.PadasExcelUtil import *
import warnings
warnings.filterwarnings('ignore')

def main():
    data = pd.read_csv("H:/model/test_score.txt", sep='\t')
    df = data.dropna()
    print("特征数量：\n", df.shape)

    x_test = df[['flow_money',"score","money_score","zf"]]
    print(x_test)

    # 3）
    # 假设 X_train 是你的训练数据
    # 数据标准化
    scaler = StandardScaler()
    x_test = scaler.transform(x_test)

    # 加载模型
    estimator = joblib.load("my_ridge_line.pkl")

    # 5）得出模型
    print("梯度下降-权重系数为：\n", estimator.coef_)
    print("梯度下降-偏置为：\n", estimator.intercept_)

    # 6）模型评估
    y_predict = estimator.predict(x_test)
    print("预测房价：\n", y_predict)
    return None

if __name__ == "__main__":
    main()